package com.yooohooo.designpattern.bean.store;

import com.yooohooo.designpattern.bean.headset.Headset;
import com.yooohooo.designpattern.bean.phone.Phone;
import com.yooohooo.designpattern.factory.method.HeadsetFactory;
import com.yooohooo.designpattern.factory.method.PhoneFactory;
import com.yooohooo.designpattern.factory.method.SonyHeadsetFactory;
import com.yooohooo.designpattern.factory.method.SonyPhoneFactory;

/**
 * @ClassName: Store
 * @Description:
 * @author Yooo
 * @date 2017年6月16日 上午1:37:28
 * 
 */
public class StoreC {
	private PhoneFactory phoneFactory;
	private HeadsetFactory headsetFactory;

	public StoreC(PhoneFactory phoneFactory, HeadsetFactory headsetFactory) {
		super();
		this.phoneFactory = phoneFactory;
		this.headsetFactory = headsetFactory;
	}

	/**
	 * 补充手机
	 */
	public void supplyPhone() {
		Phone phone = phoneFactory.getPhone();
		// 补充手机逻辑...
		System.out.println("补充" + phone.getBrand() + "手机完成");
	}

	/**
	 * 补充耳机
	 */
	public void supplyHeadset() {
		Headset headset = headsetFactory.getHeadset();
		// 补充耳机逻辑...
		System.out.println("补充" + headset.getBrand() + "耳机完成");
	}

	public static void main(String[] args) {
		StoreC storeD = new StoreC(new SonyPhoneFactory(), new SonyHeadsetFactory());
		storeD.supplyPhone();
		storeD.supplyHeadset();
	}
}
